package xyz.kail.demo.consul.cloud.server02;

import com.google.common.collect.Lists;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

/**
 * Created by Kail on 2017/4/6.
 * Copyright(c) ttpai All Rights Reserved.
 */
@RestController
@SpringBootApplication
@EnableDiscoveryClient
public class ConsulProvider02Application {

    @RequestMapping("/say/{hello}")
    public String say(@PathVariable("hello") String hello) {
        return "Hello2 " + hello;
    }

    public static void main(String[] args) {

        ArrayList<String> argsList = Lists.newArrayList(args);

        argsList.add("--server.port=8082");
        argsList.add("--spring.cloud.consul.discovery.instanceId=provider02");

        SpringApplication.run(ConsulProvider02Application.class, argsList.toArray(new String[argsList.size()]));
    }

}
